package com.icim.dao;

import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.RowMapper;
import org.springframework.stereotype.Repository;

import com.icim.entity.Ret_prd_in;

@Repository
public class RetPrdInDao {

	@Resource
    private JdbcTemplate icimJdbcTemplate;
	
	public List<Ret_prd_in> getBoxListByBoxId(String boxId) {
        String sql = "SELECT * FROM RET_PRD_IN WHERE mtrl_box_id = ?";
        return icimJdbcTemplate.query(sql, new Object[] { boxId }, new RowMapper<Ret_prd_in>() {

            @Override
            public Ret_prd_in mapRow(ResultSet rs, int rowNum) throws SQLException {
            	Ret_prd_in ret_prd_in = new Ret_prd_in();
            	ret_prd_in.setPrd_act_qty(rs.getInt("PRD_ACT_QTY"));
            	ret_prd_in.setWo_id_fk(rs.getString("WO_ID_FK"));
            	ret_prd_in.setEvt_usr(rs.getString("EVT_USR"));
            	ret_prd_in.setPrd_tl_qty(rs.getInt("PRD_TL_QTY"));
                ret_prd_in.setRcv_timestamp(rs.getTimestamp("RCV_TIMESTAMP"));
                return ret_prd_in;
            }
        });

    }
}
